<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This tests smart paste of a fragment that ends in a select element.

// There should be no spaces added because the paste is performed in an empty
// paragraph.
selection_test(
    '<div contenteditable>|</div>',
    selection => {
      selection.setClipboardData('foo<select><option>1</option></select>')
      selection.document.execCommand('paste');
    },
    [
      '<div contenteditable>',
        'foo<select><option>1</option></select>|',
      '</div>',
    ],
    'Paste into empty DIV');

selection_test(
    '<div contenteditable>a|b</div>',
    selection => {
      selection.setClipboardData('<select><option>1</option></select>')
      selection.document.execCommand('paste');
    },
    [
      '<div contenteditable>',
        'a<select><option>1</option></select>|b',
      '</div>',
    ],
    'Paste between characters');
</script>
